<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #ddv{
            width: 100px;
            height: 100px;
            background: linear-gradient(to right,#000,#ffacff,#aaaccc);
            transition: 2s;
        }
    </style>
</head>
<body>
    <div id="ddv"></div>
    <button id="but">点击</button>
</body>
</html>
<script>
    var num1 = document.getElementById('but')
    num1.onclick = function(){
        var num = document.getElementById('ddv')
        num.style.width = '200px'
        num.style.height = '200px'
    }
</script>